import 'package:flutter/services.dart';
import 'linphone_flutter_platform_interface.dart';
import 'linphone_flutter_method_channel.dart';
import 'linphone_chat_message.dart';

class LinphoneFlutter {

  Future<String?> getLinphoneVersion() {
    return LinphoneFlutterPlatform.instance.getLinphoneVersion();
  }

  Future<void> login(String username, String password, String domain) async {
    await LinphoneFlutterPlatform.instance.login(
        username, password, domain);
  }

  void setCoreListener(LinphoneListener listener)  {
    LinphoneFlutterPlatform.instance.setCoreListener(listener);
  }

  Future<void> unregister() async {
    await LinphoneFlutterPlatform.instance.unregister();
  }

  Future<void> delete() async {
    await LinphoneFlutterPlatform.instance.delete();
  }

  Future<void> terminate() async {
    await LinphoneFlutterPlatform.instance.terminate();
  }

  Future<void> accept() async {
     await LinphoneFlutterPlatform.instance.accept();
  }

  Future<void> outgoingCall(String remoteSipUri) async {
     await LinphoneFlutterPlatform.instance.outgoingCall(remoteSipUri);
  }

  Future<void> hangUp() async {
     await LinphoneFlutterPlatform.instance.hangUp();
  }

  Future<void> transferTo(String remoteSipUri) async {
     await LinphoneFlutterPlatform.instance.transferTo(remoteSipUri);
  }

  Future<void> pauseOrResume() async {
     await LinphoneFlutterPlatform.instance.pauseOrResume();
  }

  Future<bool> micEnabled() async {
    return await LinphoneFlutterPlatform.instance.micEnabled() as bool;
  }

  Future<bool> toggleSpeaker() async {
    return await LinphoneFlutterPlatform.instance.toggleSpeaker() as bool;
  }

  Future<String?> remoteAddressUri() async {
    return await LinphoneFlutterPlatform.instance.remoteAddressUri();
  }

  Future<String?> sendMessage(LinphoneChatMessage chatMessage) async{
    return await LinphoneFlutterPlatform.instance.sendMessage(chatMessage);
  }
  
  Future<bool?> requestPermissions() async{
    return await LinphoneFlutterPlatform.instance.requestPermissions();
  }
}
